package com.example.chat.visitor.service.impl;

import com.example.chat.common.utils.ConvertUtils;
import com.example.chat.visitor.dao.VisitorDAO;
import com.example.chat.visitor.pojo.dto.VisitorDTO;
import com.example.chat.visitor.pojo.entity.VisitorEntity;
import com.example.chat.visitor.service.VisitorService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

@Service
public class VisitorServiceImpl implements VisitorService {
    @Resource
    VisitorDAO visitorDAO;

    @Override
    public void save(VisitorDTO visitorDTO) {
        visitorDAO.insert(ConvertUtils.of(visitorDTO, VisitorEntity.class));
    }

    @Override
    public void updateStatus(Long id, Integer status) {
        VisitorEntity visitorEntity = new VisitorEntity();
        visitorEntity.setId(id);
        visitorEntity.setStatus(status);
        visitorDAO.updateById(visitorEntity);
    }
}
